﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;

namespace SusuCMS.Web.Areas.Admin.Controllers
{
    public class ImageController : AdminControllerBase
    {
        public ActionResult Index()
        {
            var website = WebsiteRepository.FindAll().FirstOrDefault(i => i.Id == CurrentWebsiteId);
            if (website == null)
            {
                return HttpNotFound();
            }
            
            var root = Server.MapPath(string.Format("~/Upload/images/{0}", website.Identifier));
            if (!Directory.Exists(root))
            {
                Directory.CreateDirectory(root);
            }

            ViewBag.DirectoryInfo = new DirectoryInfo(root);

            return View();
        }

    }
}
